package com.itlong.cloud.operate.resource;

import com.itlong.cloud.equip.operate.IOperateTokenImportServiceClient;
import com.itlong.cloud.operate.service.IOperateTokenImportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <desc>
 *      运营-运营管理-导入云对讲第三方账号token服务接口暴露实现类
 * </desc>
 *
 * @createDate 2018/07/16
 */
@RestController
public class OperateTokenImportServiceResource implements IOperateTokenImportServiceClient {

    @Autowired
    private IOperateTokenImportService iOperateTokenImportService;

    /**
     * <desc>
     *      第三方提供云对讲token账号导入
     * </desc>
     *
     * @param accountAndToken 账号和token数据集
     * @return 受影响的行数
     * @author wangzhi
     * @createDate 2018/07/16
     */
    @Override
    @PostMapping(path = "operate/tokenImport/import")
    public Integer importCloudIntercomToken(@RequestBody Map<String, String> accountAndToken) throws Exception {
        return iOperateTokenImportService.importCloudIntercomToken(accountAndToken);
    }

    /**
     * <desc>
     *      第三方提供云对讲appid应用账号导入
     * </desc>
     *
     * @param appid appid数据集
     * @return 受影响的行数
     * @author Juguang.S
     * @createDate 2018/12/19
     */
    @Override
    @PostMapping(path = "operate/appidImport/importAppid")
    public Integer importCloudIntercomAppid(@RequestBody Map<String, String> appid) throws Exception {
        return iOperateTokenImportService.importCloudIntercomAppid(appid);
    }

}
